/**
 * 匠言知识付费v2.0.0
 * Author: 山西匠言网络科技有限公司
 * 这不是一个免费软件，它受限于许可条款，你可以访问https://www.zsfzxkc.cn/获取更多详细信息。
 * This is not a free software, it under the license terms, you can visit https://www.zsffzxkc.cn/ get more details.
 */
<template>
	<view class="container">
		<jy-quick-btns></jy-quick-btns>
		<!-- 背景图片 -->
		<view class="img">
			<swiper :indicator-dots="true" :autoplay="true" :interval="2000" :duration="1000" :circular="true">
				<swiper-item v-for="(item, index) in pxbdata.thumb" :key="index">
					<image :src="item" mode="aspectFill"></image>
				</swiper-item>
			</swiper>
		</view>
		
		
		<!-- 达内教育 -->
		<view class="dnjy">
			<view class="dnjy-title">
				<text>{{pxbdata.name}}</text>
				<view>
					<image src="../../../static/dizhi-icon.png" mode="aspectFit"></image>
					<text>{{pxbdata.address}}</text>
				</view>
			</view>
			<view class="dnjy-btn">
				<text class="labeltext">{{pxbdata.classify}}</text>
				<view @click="make_phone(pxbdata.phone)">
					<image src="../../../static/call.png" mode="aspectFit"></image>
					<text>{{pxbdata.phone}}</text>
				</view>
			</view>
			<view class="dnjy-jianjie" :class="[{jjzhanshi:zhankai}]">
				<text>机构简介：</text>
				<jyf-parser :html="introduce" style="margin-top: 20upx;"></jyf-parser>
			</view>
			<view class="chakan" @click="zk_btn">
				<text>{{zhankai_text}}</text>
				<image src="../../../static/xiangxia1.png" mode="aspectFit"></image>
			</view>
		</view>
		
		
		<!-- 包含课程（3） -->
		<view class="bhkc">
			<view class="bhkc-title">
				<text>包含课程（{{pxbdata.course_num}}）</text>
			</view>
			<view class="bhkc-list">
				
				<view class="bhkc-list-item" v-for="(item, index) in pxbdata.pxcourses" :key="index">
					<view class="bhkc-list-item-box1">
						<image :src="item.thumb" mode="aspectFit"></image>
						<view>
							<text>{{item.name}}</text>
							<text>{{item.jianjie}}</text>
						</view>
					</view>
					<view class="qubaoming" @click="navigate(item.id)">去报名</view>
				</view>

			</view>
		</view>
		
		
		
	</view>
</template>

<script>
	import jyfParser from "@/components/jyf-parser/jyf-parser";
	export default {
		components:{
			jyfParser
		},
		data() {
			return {
				HOST_URL:uni.HOST_URL,
				pxbdata:[],
				zhankai:false,
				zhankai_text:'点击查看更多',
				introduce:''
			};
		},
		onShareAppMessage(res) {
			let path = getCurrentPages()
			let path_share = path[0].$page.fullPath
			let path_title = path[0].data.title
			let userinfo = uni.getStorageSync('userinfo')
			let base_set = uni.getStorageSync('base_set')
			if(userinfo.uid=='' || !userinfo.uid){
				uni.navigateTo({
					url:'../login/login'
				})
				return {
					title: '请先登录后再分享给好友',
					path: ''
				}
			}else{
				if (res.from === 'button') {
					
				}
				return {
					title: base_set.title,
					path: `${path_share}?pid=${userinfo.uid}`
				}
			}
		},
		onLoad(e) {
			var id=e.id
			this.get_detail(id)
		},
		methods:{
			navigate(e) {
				uni.navigateTo({
					url: '../agency-course-details/agency-course-details?id='+e
				});
			},
			make_phone(phone){
				uni.makePhoneCall({
				    phoneNumber: phone
				});
			},
			zk_btn(){
				if(this.zhankai==false){
					this.zhankai=true
					this.zhankai_text='收起'
				}else{
					this.zhankai=false
					this.zhankai_text='点击查看更多'
				}
				
			},
			get_detail(id){
				const BASE_URL = uni.BASE_URL
				uni.request({
					url: BASE_URL+'index/pxb/datadetail',
					data: {
						id:id
					},
					method:'POST',
					success:(res) =>{
						console.log(res.data);
						this.pxbdata=res.data.data
						this.introduce=res.data.data.introduce
					},
					fail:(res)=> {
						console.log(res.data);
					}
				});
			}
		}
	}
</script>

<style lang="less">


.jjzhanshi{
	height: auto !important; 
}
// 背景图片
.img {
	swiper {
		width: 750upx;
		height: 300upx;
		display: flex;
		align-items: center;
		justify-content: center;
		image {
			width: 100%;
			height: 100%;
		}
	}
}


// 达内教育
.dnjy {
	padding: 0 20upx;
	padding-top: 56upx;
	background-color: #fff;
	&-title {
		display: flex;
		justify-content: space-between;
		text {
			font-size: 34upx;
			font-weight: 700;
		}
		view {
			image {
				width: 21upx;
				height: 29upx;
				vertical-align: middle;
			}
			text {
				font-size: 25upx;
				color: #9b9b9b;
				vertical-align: middle;
				margin-left: 15upx;
			}
		}
	}
	&-btn {
		margin-top: 32upx;
		display: flex;
		justify-content: space-between;
		.labeltext {
			font-size: 24upx;
			height: 44upx;
			padding: 0 15upx;
			border-radius: 10upx;
			margin-right: 20upx;
			background-color: #ff8972;
			line-height: 44upx;
			color: #fff;
		}
		view {
			
			image {
				width: 40upx;
				height: 40upx;
				vertical-align: middle;
			}
			text {
				font-size: 25upx;
				color: #2196f3;
				vertical-align: middle;
				margin-left: 15upx;
			}
		}
	}
	&-jianjie {
		height: 320upx;
		margin-top: 20upx;
		overflow: hidden;
		text {
			font-size: 30upx;
			color: #2d2d2d;
			font-weight: 700;
			margin-bottom: 20upx;
		}
	}
	.chakan {
		text-align: center;
		text {
			font-size: 22upx;
			color: #a4a4a4;
			margin-right: 10upx;
		}
		image {
			width: 22upx;
			height: 11upx;
		}
	}

}


// 包含课程
.bhkc {
	margin-top: 70upx;
	padding: 0 20upx;
	&-title {
		font-size: 30upx;
		font-weight: 700;
		color: #131313;
	}
	&-list {
		margin-top: 15rpx;
		padding: 5px;
		background-color: #fff;
		border-radius: 10rpx;
		&-item {
			height: 140upx;
			background-color: #fff;
			border-radius: 20upx;
			display: flex;
			align-items: center;
			margin-bottom: 18upx;
			justify-content: space-between;
			&-box1 {
				display: flex;
				image {
					width: 200upx;
					height: 140rpx;
				}
				view{
					display: flex;
					justify-content: space-evenly;
					flex-direction: column;
					margin-left: 15rpx;
					text:nth-child(1) {
						font-size: 30upx;
						color: #131313;
					}
					text:nth-child(2) {
						font-size: 22upx;
						color: #959595;
					}
				}
			}
			.qubaoming {
				width: 129upx;
				height: 47upx;
				background-image: linear-gradient(90deg, #2e6dff, #7973ff);
				border-radius: 47upx;
				border: 2upx solid #fff;
				font-size: 21upx;
				color: #fff;
				text-align: center;
				line-height: 47upx;
				box-shadow: 0upx 1upx 5upx 2upx #dadcf6;
			}
		}
	}
}


</style>
